package com.ddky.pophome;

import android.view.ViewGroup;

import java.util.ArrayList;
import java.util.List;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

/**
 * description：
 * Author: 许少东
 * Created: 2/22/21 11:24 AM
 */
public class HomePageFragmentAdapter extends FragmentPagerAdapter {
    private List<Fragment> fragments = new ArrayList<>();
    public HomePageFragmentAdapter(@NonNull FragmentManager fm, int behavior,List<Fragment> homeFragments) {
        super(fm, behavior);
        fragments.clear();
        fragments.addAll(homeFragments);
    }

    @NonNull
    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }

    @Override
    public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) {
        super.destroyItem(container, position, object);
    }

    @Override
    public int getCount() {
        return fragments.size();
    }


}
